package com.tinklabs.demo.mvp.presenter;

import android.content.Context;

import java.util.List;

import com.tinklabs.demo.bean.CityGuideResult;
import com.tinklabs.demo.mvp.callback.CityGuideCallBack;
import com.tinklabs.demo.mvp.model.CityGuideModel;
import com.tinklabs.demo.net.CallbackListener;

/**
 * Created by Jennifer on 2018/4/14.
 */

public class CityGuidePresenter extends BasePresenter<CityGuideCallBack> {
    private CityGuideModel cityGuideModel;

    public CityGuidePresenter() {
        cityGuideModel = new CityGuideModel();
    }

    public void getData(final Context context) {
        cityGuideModel.getData(context, new CallbackListener<List<CityGuideResult.Item>>() {
            @Override
            public void onSuccess(List<CityGuideResult.Item> dataList) {
                if (getCallback() != null) {
                    getCallback().onSuccessResult(dataList);
                }
            }

            @Override
            public void onError(String error) {
                if (getCallback() != null) {
                    getCallback().onErrorResult(error);
                }
            }
        });
    }


}
